home *** CD-ROM | disk | FTP | other *** search
/ Gold Medal Software 3 / Gold Medal Software - Volume 3 (Gold Medal) (1994).iso / prog / proxy14.arj / MERGE2.PRX < prev    next >
Text File  |  1993-11-10  |  504b  |  17 lines

  1. eos="eos";
  2. ch1=channel();
  3. ch2=channel();
  4. ch3=channel();
  5. n=0;
  6. task merge(inp1,inp2,out;x) {
  7.  select {case inp1?x:if(x==eos) n=n+1; else out!x;if(n==2) exit;
  8.          case inp2?x:if(x==eos) n=n+1; else out!x;if(n==2) exit;
  9.         }};
  10.  
  11. task source1(out) {out!1;out!3;out!eos;};
  12. task source2(out) {out!2;out!4;out!5;out!eos;};
  13. task sink(inp;x) {while (true) {inp?x;print x;}};
  14. task main() {start source1(ch1); start source2(ch2);start merge(ch1,ch2,ch3);
  15.              start sink(ch3);};
  16. end
  17.